<template>
	<view class="verification-box">
		<view class="scan-item1" :style="{'background-image': 'url(' + bg1 + ')'}">
			<view class="desc" @click="scan">
				<view class="title">扫码核销</view>
				<view class="sub-title">扫一扫便捷核销</view>
				<view class="btn">点击进入</view>
			</view>
		</view>
		<view class="scan-item2" :style="{'background-image': 'url(' + bg2 + ')'}">
			<view class="desc" @click="goCode">
				<view class="title">核销码核销</view>
				<view class="sub-title">数字核销精准验证</view>
				<view class="btn" style="background: #5c86fc;">点击进入</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		BASE_URL
	} from '@/config/app';
	
	export default {
		data() {
			return {
				domain: BASE_URL,
				bg1: BASE_URL + '/static/images/scan.png',
				bg2: BASE_URL + '/static/images/scan_code.png',
			}
		},
		methods: {
			// 扫码核销
			scan() {
				uni.scanCode({
					success: (res) => {
						let code = res.result
						uni.navigateTo({
							url: '/pages/verification/detail?code=' + code
						})
					}
				});
			},
			goCode() {
				uni.navigateTo({
					url: '/pages/verification/code'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	uni-page-body {
		height: 100%;
		background: #fff;
		width: 100%;
	}
	.verification-box {
		width: 100%;
		height: 100%;
		padding: 40rpx;
		.scan-item1 {
			width: 100%;
			border-radius: 20rpx;
			height: 300rpx;
			background-repeat: no-repeat;
			background-size: cover;
		}
		.scan-item2 {
			width: 100%;
			border-radius: 20rpx;
			height: 300rpx;
			margin-top: 40rpx;
			background-repeat: no-repeat;
			background-size: cover;
		}
		.desc {
			width: 400rpx;
			padding-top: 80rpx;
			padding-left: 40rpx;
			
			.title {
				font-size: 38rpx;
				font-weight: bold;
			}
			.sub-title {
				margin-top: 10rpx;
				color: #565656;
			}
			.btn {
				margin-top: 20rpx;
				background: #fd7637;
				width: 160rpx;
				height: 52rpx;
				padding: 10rpx 20rpx;
				line-height: 36rpx;
				color: #fff;
				border-radius: 30rpx;
				font-size: 26rpx;
				text-align: center;
			}
		}
	}
</style>